home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / COOLVIEW.ZIP / TERMINAT.ZIP / TERMINAT.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-03-05  |  5.1 KB  |  173 lines

  1. ;
  2. ; TERMINATOR TEXT INTRO
  3. ; Coded '95 by Paradise, 1995.III.3
  4. ; Lublin, Poland
  5. ; paradise@bachus.umcs.lublin.pl
  6. ;
  7. .286
  8.  
  9. Code  SEGMENT PARA PUBLIC 'CODE'
  10.       ASSUME CS:Code, DS:Code
  11.       Org 100h
  12.  
  13.  
  14. Body  PROC FAR
  15.       ; set 400 scan lines
  16.       mov ax, 1202h
  17.       mov bl, 30h
  18.       int 10h
  19.       ; set text mode
  20.       mov ax, 3h
  21.       int 10h
  22.       ; load 8x8 font
  23.       mov ax, 1112h
  24.       mov bl, 0
  25.       int 10h
  26.       ; move screen from data
  27.       push cs
  28.       pop ds
  29.       mov si, offset Piccy
  30.       mov dx, 0b800h
  31.       mov es, dx
  32.       xor di, di
  33.       mov cx, (8000*4-160)/2
  34.       cld
  35.       rep movsw
  36.       ; Show!
  37.       call SetOffs
  38. Repeat:
  39.       in al,60h
  40.       cmp al,1
  41.       je EscPressed
  42.       add Y,3
  43.       
  44.       call SetOffs
  45.       mov ax,Y 
  46.       cmp ax,24*3*16
  47.       jg EscPressed 
  48.       jmp Repeat
  49. EscPressed:
  50.       ; set 25-lines mode
  51.       mov ax, 3h
  52.       int 10h
  53.       ; return to dos
  54.       mov ah, 4ch
  55.       int 21h
  56. Body  ENDP
  57.  
  58.  
  59. SetOffs PROC FAR
  60.    push  ds
  61.    push  si
  62.    push  es
  63.    push  di
  64.    pusha
  65.    mov   ax,40h           ; Segment 40h
  66.    mov   es,ax
  67.    mov   cl,es:49h        ; Port 49h = Video BIOS data area
  68.    mov   ax,X             ; AX := X coordinate.
  69.    mov   bx,Y             ; BX := Y coordinate.
  70.    cmp   cl,7             ; Jump if graphics mode.
  71.    ja    @l01
  72.    je    @l02             ; Jump if monocrome text.
  73.    test  byte ptr es:89h,1; If there's 1 in port 89h , we have a VGA
  74.    jnz   @l02             ; Jump if VGA present
  75.    jmp   @l03
  76. @L01:
  77.    mov   cx,8             ; CL := 8 pixels by byte.
  78.                           ; CH := 0(Line sweep preselection.
  79.    div   cl               ; AH := bit displacement in byte.
  80.                           ; AL := Byte displacement in pixels row.
  81.    mov   cl,ah            ; CL := Horizontal pixel panoramic.
  82.    xor   ah,ah
  83.    xchg  ax,bx            ; AX := Y
  84.                           ; BX := Byte displacement in pixels row.
  85.    mov   dx,160           ; DX := Chars row shown
  86.    mul   dx               ; AX := Byte displacement in row begin.
  87.    jmp   @L05
  88. @L02:
  89.    mov   cx,9             ; CL := 9 pixels by byte.
  90.    div   cl               ; AH := bit displacement in byte.
  91.                           ; AL := byte displacement in pixels row.
  92.    dec   ah               ; AH := -1, 0-7
  93.    jns   @l04             ; Jump if AL = 0-7
  94.    mov   ah,8             ; AH := 8
  95.    jmp   @L04
  96. @L03:
  97.    mov   cx,8             ; CL := 8 pixels by byte.
  98.    div   cl               ; AH := bit displacement in byte.
  99.                           ; AL := byte displacement in pixels row.
  100. @L04:
  101.    mov   cl,ah            ; Horizontal pixel panoramic value.
  102.    xor   ah,ah
  103.    xchg  ax,bx            ; AX := Y
  104.                           ; BX := byte displacement in row.
  105.    div   byte ptr es:85h  ; AL := Char`s row
  106.                           ; AH := Sweep line in characters matrix.
  107.    xchg  ah,ch            ; AX := Char`s row.
  108.                           ; CH := Sweep line.
  109.    mov   dx,160           ; DX := chars row shown
  110.    mul   dx               ; AX := Byte displacement in char`s row.
  111.    shr   ax,1             ; AX := Word displacement in char`s row.
  112.                           ; Here the operations end. Now, this is the routine that really do all.
  113.                           ; Assembler registers must have these valours :
  114.                           ;  AX : Char`s row displacement.
  115.                           ;  BX : Byte displacement in the row.
  116.                           ;  CH : Line sweep preselection
  117.                           ;  CL : Horizontal pixel panoramic
  118. @L05:
  119.    add   bx,ax
  120.    mov   dx,es:63h        ; Puerto 63h = E/S del CRTC
  121.    add   dl,6             ; Puerto del estado de video
  122. @L20:                     ; Wait for vertical retrace.
  123.    in    al,dx
  124.    test  al,8
  125.    jz    @L20
  126. @L21:                     ; Wait until vertical retrace ends.
  127.    in    al,dx
  128.    test  al,8
  129.    jnz   @L21
  130.    cli                    ; Stop interrupts.
  131.    sub   dl,6             ; DX := 3B4H or 3D4H.
  132.    mov   ah,bh            ; AH := High value for begin direction.
  133.    mov   al,0ch           ; AL := Register to modify.
  134.    out   dx,ax
  135.    mov   ah,bl            ; AH := Low  value for begin direction.
  136.    inc   al               ; AL := Register to modify.
  137.    out   dx,ax
  138.    sti                    ; Enable interrupts.
  139.    add   dl,6             ; DX := Video status port.
  140. @L22:                     ; Wait for vertical retrace.
  141.    in    al,dx
  142.    test  al,8
  143.    jz    @l22
  144.    cli                    ; Stop interrupts.
  145.    sub   dl,6             ; DX := 3B4h or 3D4H
  146.    mov   ah,ch            ; AH := Value for line sweep preselection register.
  147.    mov   al,8             ; AL := Register to change.
  148.    out   dx,ax
  149.    mov   dl,0C0h          ; Atributes controller port.
  150.    mov   al,13h OR 20h    ; Horizontal pixel panoramic register.
  151.    out   dx,al
  152.    mov   al,cl            ; Horizontal pixel panoramic value.
  153.    out   dx,al
  154.    sti                    ; Enable interrupts.
  155.    popa
  156.    pop   di
  157.    pop   es
  158.    pop   si
  159.    pop   ds
  160.    ret
  161. SetOffs ENDP
  162.  
  163.  
  164. X     DW 0
  165. Y     DW 0
  166.  
  167.  
  168. Piccy LABEL WORD
  169. include terminat.m
  170.  
  171.  
  172. Code  ENDS
  173.       END Body